function flashBoxCtrl(o, cycle){
    this.obj=document.getElementById(o);
    this.index = 0;
    this.isRoll = true;
    this.cycle = 0;
    this.len = 0;
    this.imgs = this.tags = [];

    //杩涓绉规界跺浜锛浣舵病ㄥ
    function addListener(ele,eventName,functionBody){
        if (ele.attachEvent){
            ele.attachEvent("on"+eventName, functionBody);
        }else if (ele.addEventListener){
            ele.addEventListener("on"+eventName,functionBody, false);
        }else{
            return false;
        }
    };

    //濮
    this.init=function(cycle){
        this.cycle = cycle ? cycle : 3;//榛璁3绉涓寮剧
        var objImg=this.obj.getElementsByTagName("img");
        var tagLength=objImg.length;
        this.len = tagLength;
        this.imgs = objImg;
        if (tagLength>0){
            var oUl=document.createElement("ul");
            oUl.setAttribute("id",o+"numTag");
            for (var i=0;i<tagLength;i++){
                var oLi=oUl.appendChild(document.createElement("li"));
                if (i==0){
                    oLi.setAttribute("class","hover"); //濮舵绗涓涓璁剧疆涓洪浜
                    oLi.setAttribute("className","hover");
                }
                //璁剧疆绛剧板
                oLi.appendChild(document.createTextNode((i+1)));
            }
            this.obj.appendChild(oUl);
            objImg[0].style.display="block";
            //璁剧疆绛句浠
            var oTag=this.obj.getElementsByTagName("li");
            this.tags = oTag;
            for (var i=0;i<oTag.length;i++){
                oTag[i].onmouseover=function(){
                    for (j=0;j<oTag.length;j++){
                        oTag[j].className="";
                        objImg[j].style.display="none";
                    }
                    this.className="hover";
                    objImg[this.innerHTML-1].style.display="block";
                    this.index = j;
                    this.isRoll = false;
                }
            }
            var self = this;
            setTimeout(function(){self.imgRoll();}, this.cycle * 1000);
        }
    };

    //ㄦ
    this.imgRoll=function(){
        if(this.isRoll){
            for(var i=0; i < this.len; i++){
                this.imgs[i].style.display = "none";
                this.tags[i].className = "";
            }
            this.imgs[this.index].style.display = "block";
            this.tags[this.index].className = "hover";
            this.index++;
            if(this.index == this.len) this.index = 0;
        }else{
            this.isRoll = true;
        }
        var self = this;
        setTimeout(function(){self.imgRoll();}, this.cycle * 1000);
    };

    //瀵硅薄惰ㄥ杞init()规浠ュ濮瀵硅薄
    this.init(cycle);
}